home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / Issue70 / system / Listing2.pas < prev    next >
Pascal/Delphi Source File  |  2001-05-02  |  523b  |  18 lines

  1. var
  2.   libuuidHandle: Pointer;
  3.   uuid_generate_time: procedure (out Guid: TGUID) cdecl;
  4. function CreateGUID (out Guid: TGUID): HResult;
  5. const
  6.   E_NOTIMPL = HRESULT($80004001);
  7. begin
  8.   Result := E_NOTIMPL;
  9.   if libuuidHandle = nil then begin
  10.     libuuidHandle := dlopen ('libuuid.so.1', RTLD_LAZY);
  11.     if libuuidHandle = nil then Exit;
  12.     uuid_generate_time := dlsym (libuuidHandle, 'uuid_generate_time');
  13.     if @uuid_generate_time = nil then Exit;
  14.   end;
  15.   uuid_generate_time (Guid);
  16.   Result := 0;
  17. end;
  18.